package com.webcash.CNBoard.Controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.webcash.CNBoard.Model.CalendarModel;
import com.webcash.CNBoard.Model.HistoryWithJobs;
import com.webcash.CNBoard.Model.MyProject;
import com.webcash.CNBoard.Service.HistoryService;
import com.webcash.CNBoard.util.CalendarUtil;


@Controller
@RequestMapping("/project/history")
@SessionAttributes("login" )
public class ProjectJobHistoryController {
	@Autowired
	HistoryService historyService;
	@Autowired
	MyProject myProject;
	
	@RequestMapping
	public String action(Model model){
		List<HistoryWithJobs> historyList = historyService.getHistoryListByProjectNo(myProject.getProjectNo());
		CalendarUtil calendarUtil = new CalendarUtil();
		CalendarModel cal = calendarUtil.calendar();
		model.addAttribute("historyList", historyList);
		model.addAttribute("cal", cal);
		return "project/history";
	}
}
